<?php
namespace Home\Controller;
use Think\Controller;
class Pscws4Controller extends CommonController 
{
	//中文分词
    public function index()
    {
        $w = I('q');
        
        $worlds = zw_pscws4($w);
        //var_dump($worlds);exit;
        $sql ="select t1.*,t2.username,t2.face,t3.cname from question t1 inner join user t2 on t1.uid=t2.id inner join category t3 on t1.cid=t3.id where ";

        foreach ($worlds as  $v) {
            $sql .="title like '%".$v['word']."%' or ";
        }
     
        $sql = rtrim($sql,'or ');
  
         $res = M()->query($sql);

        //print_r($res);
        $this->assign('list',$res);

        $this->assign('title','搜索词'.$w);
        $this->display(); 
    }







}